﻿function ConvertTextBox(data)
{
    var canvas;
    var des = document.createElement("div");
    $(des).css("width", data.width);
    $(des).css("height", data.height);
    des.innerHTML = "Hello";
    html2canvas([des], {
        onrendered: function (can) {
            //document.body.appendChild(can);
            var memoryStream = new Windows.Storage.Streams.InMemoryRandomAccessStream();
            Imaging.BitmapEncoder.createAsync(Imaging.BitmapEncoder.pngEncoderId, memoryStream);
            var outputPixelData = Context.getImageData(0, 0, data.width, data.height);
            //encoder.setPixelData(
            //    Imaging.BitmapPixelFormat.rgba8,
            //    Imaging.BitmapAlphaMode.straight,
            //    width,
            //    height,
            //    96, // Horizontal DPI
            //    96, // Vertical DPI
            //    outputPixelData.data
            //    );

            //encoder.flushAsync().then(function () {
            //    return memoryStream;
            //});
            //return memoryStream;
        }
    });
}